#include<stdio.h>
int statistics(char* start)
{
	int count = 0;
	while (*start)
	{
		while (*start != ' ' && *start != '\0' && *start != '.' && *start != ',' && *start != '!' && *start != '?')
		{
			start++;
		}
		/*if (*start == '.' && *(start + 1) == ' ')
		{
			count--;
		}
		if (*start == ',' && *(start + 1) == ' ')
		{
			count--;
		}*/
		if ((*start == '.' || *start == ',' || *start == '!' || *start == '?') && *(start + 1) == ' ')
		{
			count--;
		}
		count++;
		start++;
	}
	return count;
}
int main()
{
	char arr[10001] = { 0 };
	gets(arr);
	int sum = statistics(arr);
	printf("%d", sum);
	return 0;
}